<?php

namespace app\index\controller;

use app\common\controller\Frontend;
use app\common\model\ArticleModel;
use think\Request;

class Category extends Frontend
{
	//获取分类下的文章
	public function getCategoryArticle(Request $request = null){
		$param = $request->param();
		// dump( $request->param("category_id",0) );die();
		$articles = (new ArticleModel)->getArticleByCategoryId($param);
		return json(['status'=>200,'msg'=>'成功','data'=>$articles]);
	}

	//获取分类下的资源
	public function getCategoryResources(Request $request = null){
		$articles = (new ArticleModel)->getArticleByCategoryId($request->param("category_id",0),$request->param("page",1));
		return json(['status'=>200,'msg'=>'成功','data'=>$articles]);
	}

}